let options = ["rock","paper","scissors"]
let score=0
let round=1
let ready=confirm("欢迎游玩石头剪刀布"+"\n"+"是否参加游戏?")
let computer, player
while (ready){
    player=prompt("请输入你的选择: rock, paper, or scissors"+"\n"+"（请输入英文）")
    computer=options[Math.floor(Math.random()*3)]
    if (options.indexOf(player)!=-1){
        if (player == computer){
            alert("平局"+"\n"+"当前总分 = "+score.toString())
            round+=1
        }else if (player == "paper" && computer == "rock"){
            score+=10
            alert("你赢了！你出了 "+player.toUpperCase()+" ，电脑出了 "+computer.toUpperCase()+". "+"\n 当前总分 : "+score.toString()+"\n Round : "+round.toString())
            round+=1
        }else if (player == "rock" && computer == "scissors"){
            score+=10
            alert("你赢了！你出了 "+player.toUpperCase()+" ，电脑出了 "+computer.toUpperCase()+". "+"\n 当前总分 : "+score.toString()+"\n Round : "+round.toString())
            round+=1
        }else if (player == "scissors" && computer == "paper"){
            score+=10
            alert("你赢了！你出了 "+player.toUpperCase()+" ，电脑出了 "+computer.toUpperCase()+". "+"\n 当前总分 : "+score.toString()+"\n Round : "+round.toString())
            round+=1
        }else{
            score-=5
            alert("你输了！你出了 "+player.toUpperCase()+" ，电脑出了 "+computer.toUpperCase()+". "+"\n 当前总分 : "+score.toString()+"\n Round : "+round.toString())
            round+=1
        }
    }else{
        alert("你输入的选项有误，请重新输入！")
    }
    ready=confirm("是否再来一轮？")
}